package org.ljy.lotterysystem.common.exception;

//controller层发送的异常,


import lombok.Data;
import lombok.EqualsAndHashCode;
import org.ljy.lotterysystem.common.errorcode.ErrorCode;

@Data
@EqualsAndHashCode(callSuper = true)//用来使用父类的属性
public class ControllerException extends RuntimeException {

    private Integer code;

    private String message;

    //空构造为了用来序列化
    public ControllerException() {

    }

    public ControllerException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }

}
